Repository navigation
fix(translation): let the agentic provider accept identity-only pending units - #1388
Merged
Merged
Conversation
added 2 commits
November 19, 2026 22:40
…ng units A seeded draft can legitimately stay byte-identical after the translate turn: the only pending 'new' unit may be a pure identifier line (for example a parameter list row like **privileges** (*PrivilegeEntity[]*) - whose correct zh/ja text is the English itself). The unchanged-draft guard turned that correct no-op into a permanent failure, and since a failed file keeps its old recorded source hash, every hourly Fetch re-selected the same file and paid for the same no-op agent turn again (observed on Authentication-listPrivilegeGroups across 44526346422 and 44534975380; five more files escaped only because upstream changed them again to stale_source full retranslations). The seeded prompt now states the identity-translation rule and lets the agent claim it with a NO_TRANSLATION_NEEDED reply. The provider accepts an unchanged draft only with that marker and only after the same deterministic gate any translated draft must pass; gate failures still flow into the bounded repair loop, and an unchanged draft without the marker keeps failing exactly as before.
Review findings on #1388, all addressed: - P2-1: the marker check used substring containment, so a reply that merely quoted the rule in prose qualified. Matching is now line-anchored (the marker must be a reply line of its own), and a new test pins that a prose mention of the marker still fails an unchanged draft. - P2-2: the accept test's pending unit was the frontmatter title, which genuinely needs translation - the test proved the trust gap instead of the intended scenario. It now uses an identity fixture mirroring the production loop (identifier-only privileges row pending, translated title/heading seeded) and asserts the pending unit's source. - P3-1: the batch summary line and the CI step summary now report an unchanged-drafts counter so the trust-based route stays observable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Translate runs 44526346422 and 44534975380 both translated — and failed — the exact same file in both locales:
content/en/reference/api/nodejs/nodejs/Authentication/Authentication-listPrivilegeGroups.mdRoot cause chain (reproduced locally against the CI seed semantics):
a347ffbcand the Fetch checkpointbd90c871is a one-line link cleanup:**privileges** (*[PrivilegeEntity](PrivilegeEntity.md)[]*) -→**privileges** (*PrivilegeEntity[]*) -.new(English changed), so it is ineligible for the verified-current fast path and is handed to the agent.runAgenticFiletreats any unchanged seeded draft as a hard failure before running the deterministic gate, so the file fails.reason=current_deltaeach round, four paid no-op agent turns per cycle).Five other files hit the same failure earlier the same day (
Collections-addCollectionField(s),createCollection,describeCollection,getRefreshExternalCollectionProgress) and only escaped because upstream changed them again, downgrading them tostale_sourcefull retranslations.Fix
Keep the invariant that
newpending units always reach the agent, but give the agent a controlled way to express "nothing to translate":buildSeededTaskPromptstates an explicit identity-translation rule (identifier/type/code-only units must stay byte-identical) and the exact reply markerNO_TRANSLATION_NEEDED.runAgenticFileaccepts an unchanged seeded draft only when the agent replies with the marker and the unchanged bytes pass the same deterministic gate (validateWithRuntimeChecks) as any translated draft. Gate failures still flow into the bounded repair loop.With the marker path, the loop closes mechanically: the file translates (
unchangedDraftAccepted), publishes, the recorded hash advances, and the next selection no longer seescurrent_delta.Tests
runAgenticFile accepts an unchanged seeded draft when the agent reports no translation needed— marker + unchanged draft →translated, published bytes equal the seeded draft, prompt states the rule and marker.an unchanged seeded draft with the marker still goes through repair when the gate fails— marker + gate violation → bounded repair loop runs (attempts: ['translate', 'repair1']), nounchangedDraftAccepted.rejects a turn that leaves the seeded draft unchangedtest is untouched and still green (no marker → throw).Selector union for the changed paths (
pnpm test:for-change -- scripts/translation/agenticProvider.js scripts/translation/agenticProvider.test.js):pnpm test:translation— 92/92 greenagenticProvider+validate-translation-file+surgicalUpdate) — 63/63 greenpnpm test:workflow-matrix,pnpm test:workflow-policy— greenpnpm test:replay:translation— 15/16 green; the single failure (inspect rejects the wrong child workflow identity before any retained download) is pre-existing on pristinemaster(verified by stashing this change): the retained fixture commitsf3582b00/9fd45e90are unreachable fromorigin/devand are cruft-packed locally, so git 2.50's protocol-based clone cannot transfer them — environmental, not introduced here. CI is authoritative.git diff --check— cleanpromptContractSha256only hashes.github/prompts/*and locale-contract files, so the inline prompt change does not affect recovery identity contracts.